import request from '@/utils/request'
/**
 * 获取商品分类列表
 * @param {*} params
 * @returns
 */
export function getCategoryInfo(params) {
  return request({
    url: '/api/app/category-info',
    method: 'get',
    baseURL: public_config.labor_api,
    params
  })
}
/**
 * 按Id查询商品分类信息
 * @returns
 */
export function getIdCategoryInfo(Id) {
  return request({
    url: `/api/app/category-info/${Id}`,
    method: 'get',
    baseURL: public_config.labor_api
  })
}

/**
 * 商品分类树
 * @param {*} params
 * @returns
 */
export function getTreeCategoryInfo(params) {
  return request({
    url: '/api/app/category-info/tree-list',
    method: 'get',
    baseURL: public_config.labor_api,
    params
  })
}

/**
 * 获取商品简称列表
 * @param {*} params
 * @returns
 */
export function getCategoryInfoList(params) {
  return request({
    url: '/api/app/category-info/category-info-list',
    method: 'get',
    baseURL: public_config.labor_api,
    params
  })
}

/**
 * 根据Id上架或下架商品
 * @param {*} Id
 * @returns
 */
export function updateCategoryInfo(Id) {
  return request({
    url: `/api/app/category-info/product-up-and-down/${Id}`,
    method: 'post',
    baseURL: public_config.labor_api
  })
}

/**
 * 获取物料简称信息
 * @param {*} id
 * @returns
 */
export function getByIdProduct(id) {
  return request({
    url: `/api/app/category-info/${id}/product`,
    method: 'get',
    baseURL: public_config.labor_api
  })
}
